package com.hejjon.syyapi.controller;

import com.alibaba.fastjson.JSONObject;
import com.hejjon.syyapi.entity.XUser;
import com.hejjon.syyapi.service.IUserService;
import com.kern.framework.bean.ResponseResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by caoshi at 20:52 2021-10-07
 */
@RestController
public class LoginController {


    private static Logger logger = LoggerFactory.getLogger(LoginController.class);

    @Autowired
    private IUserService userService;


    @RequestMapping("/login")
    public ResponseResult login(@RequestBody JSONObject params) {
        logger.info(" = 用户登录入参: {}", params);
        ResponseResult result = new ResponseResult();
        XUser loginUser = new XUser();
        loginUser.setUsername(params.getString("username"));
        loginUser.setPassword(params.getString("password"));
        return userService.login(loginUser);
    }






}
